<template>
  <div class="home">
    <my-header v-model="title" @add="add"></my-header>

    <my-nav></my-nav>
    <my-list></my-list>
  </div>
</template>

<script>
// @ is an alias to /src
import myHeader from "@/components/myHeader.vue";
import myNav from "@/components/myNav.vue";
import myList from "@/components/myList.vue";

export default {
  data() {
    return {
      title: "",
    };
  },
  methods: {
    add() {
      console.log(111);
      let obj = {
        title: this.title,
        //标题
        status: false,
        //状态
        id: new Date().getTime(),
        //时间戳当id
      };
      this.$store.commit("add", obj);
      this.title = "";
    },
  },
  name: "HomeView",
  components: {
    myHeader,
    myNav,
    myList,
  },
};
</script>
<style lang="scss" scoped>
.home {
  width: 600px;
  margin: 50px auto;
}
</style>
